package com.scy.controller;

import com.scy.entity.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.List;

/**
 * 本类用来演示
 *
 * @author wwh
 * @date 2024/6/25 13:58 $
 */
@RestController
public class HelloController {

    @RequestMapping("/test")
    /*其实就是不让你返回资源,返回json*/
    public User getTest(){

        System.out.println("test函数被调用了");

        return new User();
    }

    @RequestMapping("/user/test")
    /*其实就是不让你返回资源,返回json*/
    public User getName(@RequestParam(name = "username",defaultValue = "佚名") String name){

        System.out.println("test函数被调用了");

        return new User();
    }

    @RequestMapping("/user/add")
    /*其实就是不让你返回资源,返回json*/
    public List<User> userListAdd(@RequestBody User user){

        System.out.println("test函数被调用了");

        List<User> users = new ArrayList<>();


        return users;
    }
}
